From: Keir Fraser Date: Tue, 21 Oct 2008 10:44:39 +0000 (+0100) Subject: Use hvm_dirq_assist() to replace {vmx,svm}_dirq_assist(). X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14066^2~4 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=3ecc1689ba4beb76694902bcbe2261074b56f10e;p=xen.git Use hvm_dirq_assist() to replace {vmx,svm}_dirq_assist(). Do not compile some IA64 MSI-related parts. Signed-off-by: Anthony Xu Signed-off-by: Dexuan Cui --- diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c index ff95cb64c1..330d587925 100644 --- a/xen/arch/x86/hvm/svm/intr.c +++ b/xen/arch/x86/hvm/svm/intr.c @@ -100,61 +100,6 @@ static void enable_intr_window(struct vcpu *v, struct hvm_intack intack) vmcb->general1_intercepts |= GENERAL1_INTERCEPT_VINTR; } -extern int vmsi_deliver(struct domain *d, int pirq); -static int hvm_pci_msi_assert(struct domain *d, int pirq) -{ - return vmsi_deliver(d, pirq); -} - -static void svm_dirq_assist(struct vcpu *v) -{ - unsigned int irq; - uint32_t device, intx; - struct domain *d = v->domain; - struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci; - struct dev_intx_gsi_link *digl; - - if ( !iommu_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) ) - return; - - for ( irq = find_first_bit(hvm_irq_dpci->dirq_mask, NR_IRQS); - irq < NR_IRQS; - irq = find_next_bit(hvm_irq_dpci->dirq_mask, NR_IRQS, irq + 1) ) - { - if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) ) - continue; - - spin_lock(&d->event_lock); - if ( test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[irq].flags) ) - { - hvm_pci_msi_assert(d, irq); - spin_unlock(&d->event_lock); - continue; - } - - stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)]); - - list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list ) - { - device = digl->device; - intx = digl->intx; - hvm_pci_intx_assert(d, device, intx); - hvm_irq_dpci->mirq[irq].pending++; - } - - /* - * Set a timer to see if the guest can finish the interrupt or not. For - * example, the guest OS may unmask the PIC during boot, before the - * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the - * guest will never deal with the irq, then the physical interrupt line - * will never be deasserted. - */ - set_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)], - NOW() + PT_IRQ_TIME_OUT); - spin_unlock(&d->event_lock); - } -} - asmlinkage void svm_intr_assist(void) { struct vcpu *v = current; @@ -163,7 +108,7 @@ asmlinkage void svm_intr_assist(void) /* Crank the handle on interrupt state. */ pt_update_irq(v); - svm_dirq_assist(v); + hvm_dirq_assist(v); do { intack = hvm_vcpu_has_pending_irq(v); diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c index a4d4235018..e62c8459f9 100644 --- a/xen/arch/x86/hvm/vmx/intr.c +++ b/xen/arch/x86/hvm/vmx/intr.c @@ -103,61 +103,6 @@ static void enable_intr_window(struct vcpu *v, struct hvm_intack intack) } } -extern int vmsi_deliver(struct domain *d, int pirq); -static int hvm_pci_msi_assert(struct domain *d, int pirq) -{ - return vmsi_deliver(d, pirq); -} - -static void vmx_dirq_assist(struct vcpu *v) -{ - unsigned int irq; - uint32_t device, intx; - struct domain *d = v->domain; - struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci; - struct dev_intx_gsi_link *digl; - - if ( !iommu_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) ) - return; - - for ( irq = find_first_bit(hvm_irq_dpci->dirq_mask, NR_IRQS); - irq < NR_IRQS; - irq = find_next_bit(hvm_irq_dpci->dirq_mask, NR_IRQS, irq + 1) ) - { - if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) ) - continue; - - spin_lock(&d->event_lock); - if ( test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[irq].flags) ) - { - hvm_pci_msi_assert(d, irq); - spin_unlock(&d->event_lock); - continue; - } - - stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)]); - - list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list ) - { - device = digl->device; - intx = digl->intx; - hvm_pci_intx_assert(d, device, intx); - hvm_irq_dpci->mirq[irq].pending++; - } - - /* - * Set a timer to see if the guest can finish the interrupt or not. For - * example, the guest OS may unmask the PIC during boot, before the - * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the - * guest will never deal with the irq, then the physical interrupt line - * will never be deasserted. - */ - set_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)], - NOW() + PT_IRQ_TIME_OUT); - spin_unlock(&d->event_lock); - } -} - asmlinkage void vmx_intr_assist(void) { struct hvm_intack intack; @@ -167,7 +112,7 @@ asmlinkage void vmx_intr_assist(void) /* Crank the handle on interrupt state. */ pt_update_irq(v); - vmx_dirq_assist(v); + hvm_dirq_assist(v); do { intack = hvm_vcpu_has_pending_irq(v); diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c index a74fcb2f89..4229e2355f 100644 --- a/xen/drivers/passthrough/io.c +++ b/xen/drivers/passthrough/io.c @@ -281,7 +281,63 @@ void hvm_dpci_msi_eoi(struct domain *d, int vector) spin_unlock(&d->event_lock); } + +extern int vmsi_deliver(struct domain *d, int pirq); +static int hvm_pci_msi_assert(struct domain *d, int pirq) +{ + return vmsi_deliver(d, pirq); +} +#endif + +void hvm_dirq_assist(struct vcpu *v) +{ + unsigned int irq; + uint32_t device, intx; + struct domain *d = v->domain; + struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci; + struct dev_intx_gsi_link *digl; + + if ( !iommu_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) ) + return; + + for ( irq = find_first_bit(hvm_irq_dpci->dirq_mask, NR_IRQS); + irq < NR_IRQS; + irq = find_next_bit(hvm_irq_dpci->dirq_mask, NR_IRQS, irq + 1) ) + { + if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) ) + continue; + + spin_lock(&d->event_lock); +#ifdef SUPPORT_MSI_REMAPPING + if ( test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[irq].flags) ) + { + hvm_pci_msi_assert(d, irq); + spin_unlock(&d->event_lock); + continue; + } #endif + stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)]); + + list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list ) + { + device = digl->device; + intx = digl->intx; + hvm_pci_intx_assert(d, device, intx); + hvm_irq_dpci->mirq[irq].pending++; + } + + /* + * Set a timer to see if the guest can finish the interrupt or not. For + * example, the guest OS may unmask the PIC during boot, before the + * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the + * guest will never deal with the irq, then the physical interrupt line + * will never be deasserted. + */ + set_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)], + NOW() + PT_IRQ_TIME_OUT); + spin_unlock(&d->event_lock); + } +} void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi, union vioapic_redir_entry *ent) diff --git a/xen/include/xen/hvm/irq.h b/xen/include/xen/hvm/irq.h index 952be135d3..e77239f290 100644 --- a/xen/include/xen/hvm/irq.h +++ b/xen/include/xen/hvm/irq.h @@ -94,5 +94,6 @@ void hvm_maybe_deassert_evtchn_irq(void); void hvm_assert_evtchn_irq(struct vcpu *v); void hvm_set_callback_via(struct domain *d, uint64_t via); +void hvm_dirq_assist(struct vcpu *v); #endif /* __XEN_HVM_IRQ_H__ */